package com.snail.billing.session;

import com.snail.billing.DataCache;
import com.snail.billing.net.BillingArrayHttpSession;
import com.snail.billing.net.BillingSecurity;
import com.snail.billing.util.BillingUtil;

public class CreateImprestOrderSession extends BillingArrayHttpSession {

	public CreateImprestOrderSession() {
		DataCache cache = DataCache.getInstance();
		String host = cache.importParams.hostBusiness;
		String address = String.format("http://%s/passport/login/createImprestOrder.do", host);
		setAddress(address);
		// addBillingPair("sessionId", BillingEncode.enCode(cache.importParams.sessionId));
		// addBillingPair("uuid", BillingEncode.enCode(AccountManager.getUUID()));
		addBillingPair("aid", cache.importParams.aid);
		// addBillingPair("gameId", cache.importParams.gameId);
		addBillingPair("nPartnerId", cache.importParams.partnerId);
		addBillingPair("gserverId", cache.importParams.serverId);
		addBillingPair("sClientIp", BillingUtil.getLocalIp());
		buildParamPair();
	}

	@Override
	public BillingSecurity getSecurity() {
		if (DataCache.getInstance().isSandbox) {
			return BillingSecurity.securitySandbox2;
		}
		return BillingSecurity.security;
	}

}
